package com.codegenerate.demo.entity; /**
========= entity ==========
*/

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import org.springframework.util.StringUtils;
import com.fasterxml.jackson.annotation.JsonIgnore;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;


@TableName(value ="app_fun")
public class AppFun implements Serializable {
  @TableId(value = "id", type = IdType.AUTO)
  private long id;


    /**
     * 是否还有 孩
     * datetime
     */
    @TableField(exist = false)
    private  Boolean  haveNext;

    @TableField(exist = false)
    private  String  funTypes;


    @TableField(exist = false)
    private List<AppFun> children;

    public List<AppFun> getChildren() {
        return children;
    }

    public void setChildren(List<AppFun> children) {
        this.children = children;
    }

    public AppFun() {
    }

    public String getFunTypes() {
        return funTypes;
    }

    public void setFunTypes(String funTypes) {
        this.funTypes = funTypes;
    }



    public Boolean getHaveNext() {
        return haveNext;
    }

    public void setHaveNext(Boolean haveNext) {
        this.haveNext = haveNext;
    }

    /**
            * 最近更新时间
            * datetime
            */
            @TableField(value = "last_edit_time")
            private LocalDateTime lastEditTime;
        

   
        
            /**
            * 最近更新人ID
            * long
            */
            @TableField(value = "edit_user_id")
            private long editUserId;
        

   
        
            /**
            * 添加时间
            * datetime
            */
            @TableField(value = "add_time")
            private LocalDateTime addTime;
        

   
        
            /**
            * 添加人
            * string
            */
            @TableField(value = "add_user")
            private String addUser;
        

   
        
            /**
            * 有效状态[数据字典=del_state] 1有效  5删除
            * long
            */
            @TableField(value = "del_state")
            private long delState;
        

   
        
            /**
            * 所有分类路径
            * string
            */
            @TableField(value = "parent_id_path")
            private String parentIdPath;
        

   
        
            /**
            * 功能地址[查询]
            * string
            */
            @TableField(value = "fun_url")
            private String funUrl;
        

   
        
            /**
            * 服务器编号ID
            * long
            */
            @TableField(value = "server_number")
            private long serverNumber;
        

   
        
            /**
            * 最近更新人
            * string
            */
            @TableField(value = "edit_user")
            private String editUser;
        

   
        
            /**
            * 添加人ID
            * long
            */
            @TableField(value = "add_user_id")
            private long addUserId;
        

   
        
            /**
            * 当前状态[查询] 1开启  5关闭  
            * long
            */
            @TableField(value = "state")
            private long state;
        

   
        
            /**
            * 排序号
            * long
            */
            @TableField(value = "order_num")
            private long orderNum;
        

   
        
            /**
            * 分类图片[查询]
            * string
            */
            @TableField(value = "img")
            private String img;
        

   
        
            /**
            * 功能深度[查询]
            * long
            */
            @TableField(value = "deep")
            private long deep;
        

   
        
            /**
            * 所属上级类别[关系=SysClass]
            * long
            */
            @TableField(value = "parent_id")
            private long parentId;
        

   
        
            /**
            * 移动端功能地址
            * string
            */
            @TableField(value = "mobile_url")
            private String mobileUrl;
        

   
        
            /**
            * 移动端应用状态
            * long
            */
            @TableField(value = "mobile_state")
            private long mobileState;
        

   
        
            /**
            * 所属者类型[数据字典=OwnerType]0应用功能1管理员追加功能2用户追加功能
            * long
            */
            @TableField(value = "owner_type")
            private long ownerType;
        

   
        
            /**
            * 功能类型[数据字典=FunType]1内部功能2外部功能
            * long
            */
            @TableField(value = "fun_scope")
            private long funScope;
        

   
        
            /**
            * 功能类型[数据字典=FunType] 1栏目 2功能  3按钮 
            * long
            */
            @TableField(value = "fun_type")
            private long funType;
        

   
        
            /**
            * 功能名称[查询]
            * string
            */
            @TableField(value = "name")
            private String name;
        

   
        
            /**
            * 所属应用[关系=AppInfo]
            * long
            */
            @TableField(value = "app_id")
            private long appId;
        

   
        
        

   




        /**
        * region  set and get
        * */
    
           public LocalDateTime getLastEditTime() {
             return lastEditTime;
          }
          public void setLastEditTime(LocalDateTime lastEditTime) {
                 this.lastEditTime = lastEditTime;
          }   
   
           public long getEditUserId() {
             return editUserId;
          }
          public void setEditUserId(long editUserId) {
                 this.editUserId = editUserId;
          }   
   
           public LocalDateTime getAddTime() {
             return addTime;
          }
          public void setAddTime(LocalDateTime addTime) {
                 this.addTime = addTime;
          }   
   
           public String getAddUser() {
             return addUser;
          }
          public void setAddUser(String addUser) {
                 this.addUser = addUser;
          }   
   
           public long getDelState() {
             return delState;
          }
          public void setDelState(long delState) {
                 this.delState = delState;
          }   
   
           public String getParentIdPath() {
             return parentIdPath;
          }
          public void setParentIdPath(String parentIdPath) {
                 this.parentIdPath = parentIdPath;
          }   
   
           public String getFunUrl() {
             return funUrl;
          }
          public void setFunUrl(String funUrl) {
                 this.funUrl = funUrl;
          }   
   
           public long getServerNumber() {
             return serverNumber;
          }
          public void setServerNumber(long serverNumber) {
                 this.serverNumber = serverNumber;
          }   
   
           public String getEditUser() {
             return editUser;
          }
          public void setEditUser(String editUser) {
                 this.editUser = editUser;
          }   
   
           public long getAddUserId() {
             return addUserId;
          }
          public void setAddUserId(long addUserId) {
                 this.addUserId = addUserId;
          }   
   
           public long getState() {
             return state;
          }
          public void setState(long state) {
                 this.state = state;
          }   
   
           public long getOrderNum() {
             return orderNum;
          }
          public void setOrderNum(long orderNum) {
                 this.orderNum = orderNum;
          }   
   
           public String getImg() {
             return img;
          }
          public void setImg(String img) {
                 this.img = img;
          }   
   
           public long getDeep() {
             return deep;
          }
          public void setDeep(long deep) {
                 this.deep = deep;
          }   
   
           public long getParentId() {
             return parentId;
          }
          public void setParentId(long parentId) {
                 this.parentId = parentId;
          }   
   
           public String getMobileUrl() {
             return mobileUrl;
          }
          public void setMobileUrl(String mobileUrl) {
                 this.mobileUrl = mobileUrl;
          }   
   
           public long getMobileState() {
             return mobileState;
          }
          public void setMobileState(long mobileState) {
                 this.mobileState = mobileState;
          }   
   
           public long getOwnerType() {
             return ownerType;
          }
          public void setOwnerType(long ownerType) {
                 this.ownerType = ownerType;
          }   
   
           public long getFunScope() {
             return funScope;
          }
          public void setFunScope(long funScope) {
                 this.funScope = funScope;
          }   
   
           public long getFunType() {
             return funType;
          }
          public void setFunType(long funType) {
                 this.funType = funType;
          }   
   
           public String getName() {
             return name;
          }
          public void setName(String name) {
                 this.name = name;
          }   
   
           public long getAppId() {
             return appId;
          }
          public void setAppId(long appId) {
                 this.appId = appId;
          }   
   
           public long getId() {
             return id;
          }
          public void setId(long id) {
                 this.id = id;
          }   
   
        /**
        * endgion  set and get
        * */

 

    /**
        * build
        */
       public static AppFun build(){
            AppFun tempEntity = new AppFun();
            return tempEntity;
    }

    /**
        * build
        */
       public  static void setDefaultValue(AppFun temp){
              
                    if(null==temp.getLastEditTime()){
                                temp.setLastEditTime(LocalDateTime.now());
                    }        
            
                    if(temp.getEditUserId()<=0){
                                temp.setEditUserId(0L);
                    }        
            
                    if(null==temp.getAddTime()){
                                temp.setAddTime(LocalDateTime.now());
                    }        
            
                    if(StringUtils.isEmpty(temp.getAddUser())){
                                temp.setAddUser("");
                    }        
            
                    if(temp.getDelState()<=0){
                                temp.setDelState(1);
                    }        
            
                    if(StringUtils.isEmpty(temp.getParentIdPath())){
                                temp.setParentIdPath("");
                    }        
            
                    if(StringUtils.isEmpty(temp.getFunUrl())){
                                temp.setFunUrl("");
                    }        
            
                    if(temp.getServerNumber()<=0){
                                temp.setServerNumber(0L);
                    }        
            
                    if(StringUtils.isEmpty(temp.getEditUser())){
                                temp.setEditUser("");
                    }        
            
                    if(temp.getAddUserId()<=0){
                                temp.setAddUserId(0L);
                    }        
            
                    if(temp.getState()<=0){
                                temp.setState(0L);
                    }        
            
                    if(temp.getOrderNum()<=0){
                                temp.setOrderNum(0L);
                    }        
            
                    if(StringUtils.isEmpty(temp.getImg())){
                                temp.setImg("");
                    }        
            
                    if(temp.getDeep()<=0){
                                temp.setDeep(0L);
                    }        
            
                    if(temp.getParentId()<=0){
                                temp.setParentId(0L);
                    }        
            
                    if(StringUtils.isEmpty(temp.getMobileUrl())){
                                temp.setMobileUrl("");
                    }        
            
                    if(temp.getMobileState()<=0){
                                temp.setMobileState(0L);
                    }        
            
                    if(temp.getOwnerType()<=0){
                                temp.setOwnerType(0L);
                    }        
            
                    if(temp.getFunScope()<=0){
                                temp.setFunScope(0L);
                    }        
            
                    if(temp.getFunType()<=0){
                                temp.setFunType(0L);
                    }        
            
                    if(StringUtils.isEmpty(temp.getName())){
                                temp.setName("");
                    }        
            
                    if(temp.getAppId()<=0){
                                temp.setAppId(0L);
                    }        
            
                    if(temp.getId()<=0){
                                temp.setId(0L);
                    }        
            


    }

    @JsonIgnore
    public LambdaQueryWrapper<AppFun> getQueryAll() {
                 var  query = new QueryWrapper<AppFun>().lambda();
        
                    if(null!=this.lastEditTime){
                                query.eq(AppFun::getLastEditTime, this.lastEditTime);
                    }        
            
                    if(this.editUserId>0){
                                query.eq(AppFun::getEditUserId, this.editUserId);
                    }        
            
                    if(null!=this.addTime){
                                query.eq(AppFun::getAddTime, this.addTime);
                    }        
            
                    if(!StringUtils.isEmpty(this.addUser)){
                                query.eq(AppFun::getAddUser, this.addUser);
                    }        
            
                    if(this.delState>0){
                                query.eq(AppFun::getDelState, this.delState);
                    }        
            
                    if(!StringUtils.isEmpty(this.parentIdPath)){
                                query.eq(AppFun::getParentIdPath, this.parentIdPath);
                    }        
            
                    if(!StringUtils.isEmpty(this.funUrl)){
                                query.eq(AppFun::getFunUrl, this.funUrl);
                    }        
            
                    if(this.serverNumber>0){
                                query.eq(AppFun::getServerNumber, this.serverNumber);
                    }        
            
                    if(!StringUtils.isEmpty(this.editUser)){
                                query.eq(AppFun::getEditUser, this.editUser);
                    }        
            
                    if(this.addUserId>0){
                                query.eq(AppFun::getAddUserId, this.addUserId);
                    }        
            
                    if(this.state>0){
                                query.eq(AppFun::getState, this.state);
                    }        
            
                    if(this.orderNum>0){
                                query.eq(AppFun::getOrderNum, this.orderNum);
                    }        
            
                    if(!StringUtils.isEmpty(this.img)){
                                query.eq(AppFun::getImg, this.img);
                    }        
            
                    if(this.deep>0){
                                query.eq(AppFun::getDeep, this.deep);
                    }        
            
                    if(this.parentId>=0){
                                query.eq(AppFun::getParentId, this.parentId);
                    }        
            
                    if(!StringUtils.isEmpty(this.mobileUrl)){
                                query.eq(AppFun::getMobileUrl, this.mobileUrl);
                    }        
            
                    if(this.mobileState>0){
                                query.eq(AppFun::getMobileState, this.mobileState);
                    }        
            
                    if(this.ownerType>0){
                                query.eq(AppFun::getOwnerType, this.ownerType);
                    }        
            
                    if(this.funScope>0){
                                query.eq(AppFun::getFunScope, this.funScope);
                    }        
            
                    if(this.funType>0){
                                query.eq(AppFun::getFunType, this.funType);
                    }        
            
                    if(!StringUtils.isEmpty(this.name)){
                                query.eq(AppFun::getName, this.name);
                    }        
            
                    if(this.appId>0){
                                query.eq(AppFun::getAppId, this.appId);
                    }        
            
                    if(this.id>0){
                                query.eq(AppFun::getId, this.id);
                    }

                    if(!StringUtils.isEmpty(this.funTypes)){
                        var funtypes = this.funTypes.split(",");
                        query.in(AppFun::getFunType, funtypes);
                    }



        return  query;

    }

     @JsonIgnore
      public static LambdaQueryWrapper<AppFun> getQuery(){
        var query = new QueryWrapper<AppFun>().lambda();
        return query;
    }


  @JsonIgnore
     public LambdaUpdateWrapper<AppFun> getUpdateWrapper() {
        var  updateWrapper = new UpdateWrapper<AppFun>().lambda();
        
             if(null!=this.lastEditTime){ 
              
                         updateWrapper.set(AppFun::getLastEditTime, this.lastEditTime);
              
                    }        
          
             if(this.editUserId>0){ 
              
                         updateWrapper.set(AppFun::getEditUserId, this.editUserId);
              
                    }        
          
             if(null!=this.addTime){ 
              
                         updateWrapper.set(AppFun::getAddTime, this.addTime);
              
                    }        
          
             if(!StringUtils.isEmpty(this.addUser)){ 
              
                         updateWrapper.set(AppFun::getAddUser, this.addUser);
              
                    }        
          
             if(this.delState>0){ 
              
                         updateWrapper.set(AppFun::getDelState, this.delState);
              
                    }        
          
             if(!StringUtils.isEmpty(this.parentIdPath)){ 
              
                         updateWrapper.set(AppFun::getParentIdPath, this.parentIdPath);
              
                    }        
          
             if(!StringUtils.isEmpty(this.funUrl)){ 
              
                         updateWrapper.set(AppFun::getFunUrl, this.funUrl);
              
                    }        
          
             if(this.serverNumber>0){ 
              
                         updateWrapper.set(AppFun::getServerNumber, this.serverNumber);
              
                    }        
          
             if(!StringUtils.isEmpty(this.editUser)){ 
              
                         updateWrapper.set(AppFun::getEditUser, this.editUser);
              
                    }        
          
             if(this.addUserId>0){ 
              
                         updateWrapper.set(AppFun::getAddUserId, this.addUserId);
              
                    }        
          
             if(this.state>0){ 
              
                         updateWrapper.set(AppFun::getState, this.state);
              
                    }        
          
             if(this.orderNum>0){ 
              
                         updateWrapper.set(AppFun::getOrderNum, this.orderNum);
              
                    }        
          
             if(!StringUtils.isEmpty(this.img)){ 
              
                         updateWrapper.set(AppFun::getImg, this.img);
              
                    }        
          
             if(this.deep>0){ 
              
                         updateWrapper.set(AppFun::getDeep, this.deep);
              
                    }        
          
             if(this.parentId>0){ 
              
                         updateWrapper.set(AppFun::getParentId, this.parentId);
              
                    }        
          
             if(!StringUtils.isEmpty(this.mobileUrl)){ 
              
                         updateWrapper.set(AppFun::getMobileUrl, this.mobileUrl);
              
                    }        
          
             if(this.mobileState>0){ 
              
                         updateWrapper.set(AppFun::getMobileState, this.mobileState);
              
                    }        
          
             if(this.ownerType>0){ 
              
                         updateWrapper.set(AppFun::getOwnerType, this.ownerType);
              
                    }        
          
             if(this.funScope>0){ 
              
                         updateWrapper.set(AppFun::getFunScope, this.funScope);
              
                    }        
          
             if(this.funType>0){ 
              
                         updateWrapper.set(AppFun::getFunType, this.funType);
              
                    }        
          
             if(!StringUtils.isEmpty(this.name)){ 
              
                         updateWrapper.set(AppFun::getName, this.name);
              
                    }        
          
             if(this.appId>0){ 
              
                         updateWrapper.set(AppFun::getAppId, this.appId);
              
                    }        
          
             if(this.id>0){ 
              
                     updateWrapper.eq(AppFun::getId, this.id);
              
                    }        
          


        return updateWrapper;
    }

}